package com.local.es.pojo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class GoodsESDoc implements Serializable {
    private Integer goodsId;
    private String goodsName;
    private String goodsImg;
    private String brand;
    private Integer stock;
    private String intro;
    private Integer origiPrice;
    private Integer salePrice;
    private String tag;
    private String all;
    private List<String> suggestion;//搜索的自动补全

    public GoodsESDoc(){}
    public GoodsESDoc(Goods goods){
        this.goodsId = goods.getGoodsId();
        this.goodsName = goods.getGoodsName();
        this.goodsImg = goods.getGoodsImg();
        this.brand = goods.getBrand();
        this.stock = goods.getStock();
        this.intro = goods.getIntro();
        this.origiPrice = goods.getOrigiPrice();
        this.salePrice = goods.getSalePrice();
        this.tag = goods.getTag();

        this.suggestion = new ArrayList<>();
        this.suggestion.add(goods.getGoodsName());
        this.suggestion.add(goods.getBrand());
        Collections.addAll(this.suggestion, goods.getTag().split(" "));
    }

    public Integer getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(Integer goodsId) {
        this.goodsId = goodsId;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

    public String getGoodsImg() {
        return goodsImg;
    }

    public void setGoodsImg(String goodsImg) {
        this.goodsImg = goodsImg;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public Integer getStock() {
        return stock;
    }

    public void setStock(Integer stock) {
        this.stock = stock;
    }

    public String getIntro() {
        return intro;
    }

    public void setIntro(String intro) {
        this.intro = intro;
    }

    public Integer getOrigiPrice() {
        return origiPrice;
    }

    public void setOrigiPrice(Integer origiPrice) {
        this.origiPrice = origiPrice;
    }

    public Integer getSalePrice() {
        return salePrice;
    }

    public void setSalePrice(Integer salePrice) {
        this.salePrice = salePrice;
    }

    public String getTag() {
        return tag;
    }

    public void setTag(String tag) {
        this.tag = tag;
    }

    public String getAll() {
        return all;
    }

    public void setAll(String all) {
        this.all = all;
    }

    public List<String> getSuggestion() {
        return suggestion;
    }

    public void setSuggestion(List<String> suggestion) {
        this.suggestion = suggestion;
    }

    @Override
    public String toString() {
        return "GoodsESDoc{" +
                "goodsId=" + goodsId +
                ", goodsName='" + goodsName + '\'' +
                ", goodsImg='" + goodsImg + '\'' +
                ", brand='" + brand + '\'' +
                ", stock=" + stock +
                ", intro=" + intro +
                ", origiPrice=" + origiPrice +
                ", salePrice=" + salePrice +
                ", tag='" + tag + '\'' +
                ", all='" + all + '\'' +
                ", suggestion=" + suggestion +
                '}';
    }
}
